import requests

headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'}

def translate(word):

    url = 'https://fanyi.baidu.com/sug'

    data = {'kw': word}

    response = requests.post(url, data=data, headers=headers)

    return response.json()['data'][0]['v']



word = input('请输入需要翻译的单词：')

print('翻译结果为：', translate(word))
